#!/bin/bash
#function dbl {
#	read -p "enter a value: " value
#	echo $[ $value * 2 ]
#}
#result=$(dbl)
#echo "result : $result"

function addem {
	if [ $# -eq 0 ] || [ $# -gt 2 ]
	then
		echo -1
	elif [ $# -eq 1 ]
	then
		echo $[ $1 + $1 ]
	else
		echo $[ $2 + $1 ]
	fi

}
echo -n "adding 10 and 15: "
value=$(addem 10 15)
echo $value
echo -n "let's try adding just one number"
value=$(addem 10)
echo $value
echo -n "Now trying adding no numbers: "
value=$(addem)
echo $value
echo -n "Finally, try adding three numbers: "
value=$(addem 10 15 20)
echo $value

function func7 {
	echo $[ $1 * $2 ]
 }

 if [ $# -eq 2 ]
 then
	 value=$(func7 $1 $2)
	 echo "the result is $value"
 else
	 echo "usage: a b"
 fi
